<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第24题</title>
    <script>
        // 所有的四位数
        for (var i = 1000; i <= 9999; i++) {
            // 四位数的四次方和
            var ge = i % 10,
            shi = parseInt(i / 10) % 10,
            bai = parseInt(i / 100) % 10,
            qian = parseInt(i / 1000);
            var sum = ge * ge * ge * ge + shi * shi * shi *shi + bai * bai * bai * bai + qian * qian * qian * qian; 
            // 判断 sum 是否等于 i
            if (sum == i) {
            console.log(i);
            }
        }
        
    </script>
</head>
<body>
    
</body>
</html>